#include <stdio.h>
#include <math.h>

void tree_part(char letter, int indent, int count) {
    int first_indent = indent + count;
    for(int i = 0; i < first_indent; i++) {
        putchar(' ');
    }
    putchar(letter);
    putchar('\n');
    for(int i = 0; i < indent; i++) {
        putchar(' ');
    }
    int second_letters_count = count * 2 + 1;
    for(int i = 0; i < second_letters_count; i++) {
        putchar(letter);
    }
    putchar('\n');
}

int main(void) {
    int n = 0;
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        getchar();
        char letter = getchar();
        int indent = letter - 'A';
        int count = 1;
        for(char i = 'A'; i <= letter; i++) {
            tree_part(i, indent--, count++);
        }
    }
    return 0;
}
